package com.min.main.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.min.common.entity.BaseController;
import com.min.common.entity.QueryPage;
import com.min.common.entity.R;
import com.min.main.entity.DictEntity;
import com.min.main.service.DictService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 字典表
 *
 * @author fengt
 * @date 2021-07-30
 */
@RestController
@RequestMapping("/dict")
public class DictController extends BaseController<DictEntity, DictService> {

    @GetMapping("/root")
    public R roots() {
        return this.service.getRoots();
    }

    @Override
    public R list(@RequestBody QueryPage<DictEntity> page) {
        return this.service.tree(page);
    }

    @Override
    public R remove(@RequestBody List<Long> ids) {
        return this.service.removeWithSub(ids);
    }
}
